package csc.daonjpa.java.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import share.Constant;

@Controller
public class HomeController {
	
	@RequestMapping(value = {"login"})
	public String toLogin(Model model) {
		return Constant.VIEW_LOGIN;
	}
	
	@RequestMapping(value = {"logout"})
	public String logout(Model model, HttpServletRequest request) {
		request.getSession().removeAttribute(Constant.SESSION_ATR_CUSTOMER_ID);
		request.getSession().removeAttribute(Constant.SESSION_ATR_IS_CUSTOMER);
		request.getSession().removeAttribute(Constant.SESSION_ATR_LOGIN_FAIL);
		request.getSession().removeAttribute(Constant.SESSION_ATR_LOGINID);
		return "redirect:/" + Constant.VIEW_LOGIN;
	}
	
	@RequestMapping(value = {"transactionDetail"})
	public String adminDetail(Model model, HttpServletRequest request) {
		return "admin_detail";
	}
	
	@RequestMapping(value = {"transactionDetailApprove"})
	public String adminDetailApprove(Model model, HttpServletRequest request) {
		return "admin_detail_approve";
	}
	
	
}
